<?php
require_once('paths.inc');
require_once(INCLUDE_PATH.'constants.inc');
require_once('page.inc');
require_once(DB_PATH.'db.inc');
require_once('security.inc');

session_start();
unset($_SESSION['authUser']);

html_header_login(LANG_Login);
include_js('validations.js');

?>
	<div align="center">
	  <form method="POST" action="authenticate.php" 
	      onsubmit="return (validateUsername(this.formUsername.value, <?php echo CT_MIN_USERNAME_LENGTH;?>)
	                && validateAlphanum(this.formPassword.value, <?php echo "'".LANG_Password."', true, ".CT_MIN_PASSWORD_LENGTH;?>));">
	    <h3> <?php echo LANG_Login; ?> </h3>
	    
	    <!-- ouputs a special login message, if set-->
	    <?php output_error_msg(); ?>
	    <table align="center">
	      <tr>
	        <td><?php echo LANG_Username; ?>:</td>
	        <td><input class="box" type="text" size="15" maxlength="<?php echo CT_MAX_USERNAME_LENGTH;?>" name="formUsername"></td>
	      </tr>
	      <tr>
	        <td><?php echo LANG_Password; ?>:</td>
	        <td><input class="box" type="password" size="15" maxlength="<?php echo CT_MAX_PASSWORD_LENGTH;?>" name="formPassword"></td>
	      </tr>
	    </table>
	    <input class="btn" type="submit" value="<?php echo LANG_Log_in; ?>">
	    <p><a href="forgot.php"><?php echo LANG_forgot; ?></a></p>
	    <p><a href="add_client.php"><?php echo LANG_SING_UP; ?></a></p>
	  </form>
  </div>

<?php
	html_footer("login");
?>
